<?php
class Mem{
    private static $instance = NULL;
    private function __construct() { }
    private function __clone() { }
    public static function getInstance() {
        if (!self::$instance) {
            self::$instance = new Memcached;  //声明一个新的memcached链接
            self::$instance->setOption(Memcached::OPT_COMPRESSION,false); //关闭压缩功能
            self::$instance->setOption(Memcached::OPT_BINARY_PROTOCOL,true); //使用binary二进制协议
            self::$instance->addServer('3471aaaa7a3b414c.m.cnqdalicm9pub001.ocs.aliyuncs.com',11211);
        }
        return self::$instance;
    }
}